<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Inoutquery</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
	<script type="text/javascript" src="scripts/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="scripts/Myscripts/alpha_add.js"></script>
	
  </head>
  
  <body>
  <script type="text/javascript">
  	var req=false;
  	function pressquery(){
  		//alert("!");
  		if (window.XMLHttpRequest) {

             req = new XMLHttpRequest();

         }else if (window.ActiveXObject) {

             req = new ActiveXObject("Microsoft.XMLHTTP");

         }
         if(req)
         {
         	req.open("post","distribution/Getinoutbyquery.jsp",true);
         	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
         	req.onreadystatechange=callback;
         	var storeroom = document.getElementById("storeroom_name_id").value;
         	if(storeroom==null)
         		storeroom="";
         	var name =document.getElementById("product_name_id").value;
         	if(name==null)
         		name="";
         		
         	var begin_time = document.getElementById("begin_id").value;
         	if(begin_time==null)
         		begin_time="";
         	
         	//alert(begin_time);
         	
         	var end_time = document.getElementById("end_id").value;
         	if(end_time==null)
         		end_time="";
         		
         	//alert(end_time);
         		//alert(encodeURIComponent(name));
         		req.send("storeroom="+storeroom+"&name="+encodeURIComponent(name)+"&begin_time="+begin_time+"&end_time="+end_time);
         }
  	}
  	function callback(){
  		if(req.readyState==4)
  		{
  			if(req.status=200)
  			{
  				//alert("!!!");
  				var xmlDoc = req.responseXML.documentElement;
  				var xinouts = xmlDoc.getElementsByTagName('inoutstoreroom');
  				var inoutroom_table=document.getElementById("inoutstorerooms");
  				var inner_string=init_table_String;
  				for(var i=0;i<xinouts.length;++i)
  				{
  					var t_inout_id = xinouts[i].childNodes[0].firstChild.nodeValue;
  					var t_storeroom_name= xinouts[i].childNodes[1].firstChild.nodeValue;
  					var t_product_id= xinouts[i].childNodes[2].firstChild.nodeValue;
  					var t_product_name= xinouts[i].childNodes[3].firstChild.nodeValue;
  					var t_price= xinouts[i].childNodes[4].firstChild.nodeValue;
  					var t_product_number= xinouts[i].childNodes[5].firstChild.nodeValue;
  					var t_total_price= xinouts[i].childNodes[6].firstChild.nodeValue;
  					var t_inoutdate= xinouts[i].childNodes[7].firstChild.nodeValue;
  					var t_inouttype = xinouts[i].childNodes[8].firstChild.nodeValue;
  					inner_string+="<tr><td align=\"center\">"+t_inout_id+"</td><td align=\"center\">"+t_storeroom_name+"</td><td align=\"center\">"+t_product_id+"</td><td align=\"center\">"+t_product_name+"</td><td align=\"center\">"+t_price+"</td><td align=\"center\">"+t_product_number+"</td><td align=\"center\">"+t_total_price+"</td><td align=\"center\">"+t_inoutdate+"</td><td align=\"center\">"+t_inouttype+"</td></tr>"
  				}
  				inoutroom_table.innerHTML=inner_string;
  			}
  		}
  	}
  </script>
  <div id = "add_alpha_id">
   <div id="container">
    <div class = "ui_content">
    <div class = "box_border">
    <div id = "box_top"><font size=5>出入库单明细</font></div>
    </div>
    </div>
    <div class = "ui_content">
    <div class = "box_border">
   		<table class = "table" width="100%">
   			<tr>
   			<td><label>库房：</label></td><td><input type="text" id = "storeroom_name_id" onblur="pressquery()" class="ui_input_txt02"></td>
   			<td><label>商品名：</label></td><td><input type="text" id = "product_name_id" onblur="pressquery()" class="ui_input_txt02"></td>
   			</tr>
   			<tr>
   			<td><label>开始时间：</label></td><td><input type="text" id = "begin_id" onblur="pressquery()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'end_id\')}'})" class="ui_input_txt02"></td>
   			<td><label>结束时间：</label></td><td><input type="text" id ="end_id" onblur="pressquery()" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'begin_id\')}',startDate:'#F{$dp.$D(\'begin_id\',{d:+1})}'})" class="ui_input_txt02"></td>
   			</tr>
   		</table>
   		<div id = "box_bottom"> <input type="button" value = "确定" class="ui_input_btn01" onclick="pressquery();alert('已刷新！')"></div>
   	</div>
   	</div>
   	<div class = "ui_content">
   	<div class = "box_border">
   	<table id = "inoutstorerooms" class = "table" width="100%">
   		<tr><th align="center"><label>出入库单号</label></th><th align="center"><label>仓库名</label></th><th align="center"><label>商品id</label></th><th align="center"><label>商品名</label></th><th align="center"><label>单价</label></th><th><label align="center">商品数量</label></th><th><label align="center">金额</label></th><th align="center"><label>出入库日期</label></th><th align="center"><label>出入库类型</label></th></tr>
   	</table>
   	</div>
   	</div>
   	</div>
   </div>
   <script type="text/javascript">
   var init_table_String = document.getElementById("inoutstorerooms").innerHTML;
   pressquery();
   </script>
   <script type="text/javascript">
   var eitem = document.getElementById("add_alpha_id");
   window.onload = add_alpha(eitem);
   </script>
  </body>
</html>
